//-----------------------------------------------------------------------
// <copyright file="a_DomPrefSDAOBase.cs" company="AACECOM">
//     Copyright (c) AACECOM. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using Microsoft.Practices.EnterpriseLibrary.Data;
using ThoiTrang.Entities;

namespace ThoiTrang.Data
{    
    public abstract class a_DomPrefSDAOBase
    {
        #region Common methods
        public virtual a_DomPrefS Createa_DomPrefSFromReader(IDataReader reader)
        {
            a_DomPrefS item = new a_DomPrefS();
            try
            {
                if (!reader.IsDBNull(reader.GetOrdinal("PrefID"))) item.PrefID = (int)reader["PrefID"];
                if (!reader.IsDBNull(reader.GetOrdinal("DomainID"))) item.DomainID = (int)reader["DomainID"];
                if (!reader.IsDBNull(reader.GetOrdinal("PageSize"))) item.PageSize = (int)reader["PageSize"];
                if (!reader.IsDBNull(reader.GetOrdinal("PageSetSize"))) item.PageSetSize = (int)reader["PageSetSize"];
                if (!reader.IsDBNull(reader.GetOrdinal("InventoryMode"))) item.InventoryMode = (bool)reader["InventoryMode"];
                if (!reader.IsDBNull(reader.GetOrdinal("ProductMode"))) item.ProductMode = (bool)reader["ProductMode"];
                if (!reader.IsDBNull(reader.GetOrdinal("FreeShipping"))) item.FreeShipping = (bool)reader["FreeShipping"];
                if (!reader.IsDBNull(reader.GetOrdinal("FreeShippingService"))) item.FreeShippingService = (int)reader["FreeShippingService"];
                if (!reader.IsDBNull(reader.GetOrdinal("FreeShippingReqAmt"))) item.FreeShippingReqAmt = (decimal)reader["FreeShippingReqAmt"];
                if (!reader.IsDBNull(reader.GetOrdinal("FreeShippingMsg"))) item.FreeShippingMsg = (string)reader["FreeShippingMsg"];
                if (!reader.IsDBNull(reader.GetOrdinal("FreeTax"))) item.FreeTax = (bool)reader["FreeTax"];
                if (!reader.IsDBNull(reader.GetOrdinal("FreeTaxReqAmt"))) item.FreeTaxReqAmt = (decimal)reader["FreeTaxReqAmt"];
                if (!reader.IsDBNull(reader.GetOrdinal("FreeTaxMsg"))) item.FreeTaxMsg = (string)reader["FreeTaxMsg"];
                if (!reader.IsDBNull(reader.GetOrdinal("OrigCity"))) item.OrigCity = (string)reader["OrigCity"];
                if (!reader.IsDBNull(reader.GetOrdinal("OrigState"))) item.OrigState = (string)reader["OrigState"];
                if (!reader.IsDBNull(reader.GetOrdinal("OrigZipCode"))) item.OrigZipCode = (string)reader["OrigZipCode"];
                if (!reader.IsDBNull(reader.GetOrdinal("OrigCountry"))) item.OrigCountry = (string)reader["OrigCountry"];
                if (!reader.IsDBNull(reader.GetOrdinal("ShipQuoteMethod1"))) item.ShipQuoteMethod1 = (byte)reader["ShipQuoteMethod1"];
                if (!reader.IsDBNull(reader.GetOrdinal("ShipQuoteMethod2"))) item.ShipQuoteMethod2 = (byte)reader["ShipQuoteMethod2"];
                if (!reader.IsDBNull(reader.GetOrdinal("ShippingCutOffTime"))) item.ShippingCutOffTime = (string)reader["ShippingCutOffTime"];
                if (!reader.IsDBNull(reader.GetOrdinal("ShippingSurCharge"))) item.ShippingSurCharge = (double)reader["ShippingSurCharge"];
                if (!reader.IsDBNull(reader.GetOrdinal("ShippingSurChargeUnit"))) item.ShippingSurChargeUnit = (bool)reader["ShippingSurChargeUnit"];
                if (!reader.IsDBNull(reader.GetOrdinal("AllowShip3rdParty"))) item.AllowShip3rdParty = (bool)reader["AllowShip3rdParty"];
                if (!reader.IsDBNull(reader.GetOrdinal("AllowShipAsGift"))) item.AllowShipAsGift = (bool)reader["AllowShipAsGift"];
                if (!reader.IsDBNull(reader.GetOrdinal("WeightRangeCriteria"))) item.WeightRangeCriteria = (bool)reader["WeightRangeCriteria"];
                if (!reader.IsDBNull(reader.GetOrdinal("WeightRangeWOther"))) item.WeightRangeWOther = (bool)reader["WeightRangeWOther"];
                if (!reader.IsDBNull(reader.GetOrdinal("UsuallyShipQtyLevel"))) item.UsuallyShipQtyLevel = (int)reader["UsuallyShipQtyLevel"];
                if (!reader.IsDBNull(reader.GetOrdinal("ShowOutStockProd"))) item.ShowOutStockProd = (bool)reader["ShowOutStockProd"];
                if (!reader.IsDBNull(reader.GetOrdinal("AllowOutStockOrder"))) item.AllowOutStockOrder = (bool)reader["AllowOutStockOrder"];
                if (!reader.IsDBNull(reader.GetOrdinal("OutStockMsg"))) item.OutStockMsg = (string)reader["OutStockMsg"];
                if (!reader.IsDBNull(reader.GetOrdinal("UsuallyShipInvN"))) item.UsuallyShipInvN = (string)reader["UsuallyShipInvN"];
                if (!reader.IsDBNull(reader.GetOrdinal("UsuallyShipInvYontime"))) item.UsuallyShipInvYontime = (string)reader["UsuallyShipInvYontime"];
                if (!reader.IsDBNull(reader.GetOrdinal("UsuallyShipInvYlate"))) item.UsuallyShipInvYlate = (string)reader["UsuallyShipInvYlate"];
                if (!reader.IsDBNull(reader.GetOrdinal("TopNumberProd"))) item.TopNumberProd = (string)reader["TopNumberProd"];
                if (!reader.IsDBNull(reader.GetOrdinal("SendLeadTo"))) item.SendLeadTo = (string)reader["SendLeadTo"];
                if (!reader.IsDBNull(reader.GetOrdinal("SendDropShip"))) item.SendDropShip = (bool)reader["SendDropShip"];
                if (!reader.IsDBNull(reader.GetOrdinal("SendDropShipTo"))) item.SendDropShipTo = (string)reader["SendDropShipTo"];
                if (!reader.IsDBNull(reader.GetOrdinal("SendCSRTo"))) item.SendCSRTo = (string)reader["SendCSRTo"];
                if (!reader.IsDBNull(reader.GetOrdinal("NewCustomerSurvey"))) item.NewCustomerSurvey = (bool)reader["NewCustomerSurvey"];
                if (!reader.IsDBNull(reader.GetOrdinal("SendmailID"))) item.SendmailID = (int)reader["SendmailID"];
                if (!reader.IsDBNull(reader.GetOrdinal("PromoTimeStart"))) item.PromoTimeStart = (string)reader["PromoTimeStart"];
                if (!reader.IsDBNull(reader.GetOrdinal("PromoTimeEnd"))) item.PromoTimeEnd = (string)reader["PromoTimeEnd"];
                if (!reader.IsDBNull(reader.GetOrdinal("PromoAutoExpireSD"))) item.PromoAutoExpireSD = (byte)reader["PromoAutoExpireSD"];
                if (!reader.IsDBNull(reader.GetOrdinal("PromoAutoExpireED"))) item.PromoAutoExpireED = (byte)reader["PromoAutoExpireED"];
                if (!reader.IsDBNull(reader.GetOrdinal("Adm_PageSize"))) item.Adm_PageSize = (int)reader["Adm_PageSize"];
                if (!reader.IsDBNull(reader.GetOrdinal("Adm_PageSetSize"))) item.Adm_PageSetSize = (int)reader["Adm_PageSetSize"];
                if (!reader.IsDBNull(reader.GetOrdinal("DomainIP"))) item.DomainIP = (string)reader["DomainIP"];
                if (!reader.IsDBNull(reader.GetOrdinal("DomainRootFolder"))) item.DomainRootFolder = (string)reader["DomainRootFolder"];
                if (!reader.IsDBNull(reader.GetOrdinal("Req_CSC"))) item.Req_CSC = (bool)reader["Req_CSC"];
                if (!reader.IsDBNull(reader.GetOrdinal("Req_MatchBillAddr"))) item.Req_MatchBillAddr = (bool)reader["Req_MatchBillAddr"];
                if (!reader.IsDBNull(reader.GetOrdinal("Req_MatchCardholder"))) item.Req_MatchCardholder = (bool)reader["Req_MatchCardholder"];
                if (!reader.IsDBNull(reader.GetOrdinal("CODCharge"))) item.CODCharge = (decimal)reader["CODCharge"];
                if (!reader.IsDBNull(reader.GetOrdinal("PayPalEmail"))) item.PayPalEmail = (string)reader["PayPalEmail"];
                if (!reader.IsDBNull(reader.GetOrdinal("Currency"))) item.Currency = (string)reader["Currency"];
                if (!reader.IsDBNull(reader.GetOrdinal("PromoEligible"))) item.PromoEligible = (bool)reader["PromoEligible"];
                if (!reader.IsDBNull(reader.GetOrdinal("StoreCount"))) item.StoreCount = (int)reader["StoreCount"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_CC"))) item.Gateway_CC = (string)reader["Gateway_CC"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_Check"))) item.Gateway_Check = (string)reader["Gateway_Check"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_Login1"))) item.Gateway_Login1 = (string)reader["Gateway_Login1"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_Login2"))) item.Gateway_Login2 = (string)reader["Gateway_Login2"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_Password"))) item.Gateway_Password = (string)reader["Gateway_Password"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_TransMode"))) item.Gateway_TransMode = (bool)reader["Gateway_TransMode"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_TransType"))) item.Gateway_TransType = (string)reader["Gateway_TransType"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_Host"))) item.Gateway_Host = (string)reader["Gateway_Host"];
                if (!reader.IsDBNull(reader.GetOrdinal("Gateway_Port"))) item.Gateway_Port = (string)reader["Gateway_Port"];
                if (!reader.IsDBNull(reader.GetOrdinal("NumOfRetry"))) item.NumOfRetry = (int)reader["NumOfRetry"];
                if (!reader.IsDBNull(reader.GetOrdinal("Req_UserAgreement"))) item.Req_UserAgreement = (bool)reader["Req_UserAgreement"];
                if (!reader.IsDBNull(reader.GetOrdinal("LineDescOption"))) item.LineDescOption = (byte)reader["LineDescOption"];
                if (!reader.IsDBNull(reader.GetOrdinal("MapBrand"))) item.MapBrand = (string)reader["MapBrand"];
                if (!reader.IsDBNull(reader.GetOrdinal("MapColors"))) item.MapColors = (string)reader["MapColors"];
                if (!reader.IsDBNull(reader.GetOrdinal("MapSizes"))) item.MapSizes = (string)reader["MapSizes"];
                if (!reader.IsDBNull(reader.GetOrdinal("MapCustom1"))) item.MapCustom1 = (string)reader["MapCustom1"];
                if (!reader.IsDBNull(reader.GetOrdinal("MapCustom2"))) item.MapCustom2 = (string)reader["MapCustom2"];
                if (!reader.IsDBNull(reader.GetOrdinal("MapCustom3"))) item.MapCustom3 = (string)reader["MapCustom3"];
                if (!reader.IsDBNull(reader.GetOrdinal("MapCustom4"))) item.MapCustom4 = (string)reader["MapCustom4"];
                if (!reader.IsDBNull(reader.GetOrdinal("GroupID"))) item.GroupID = (int)reader["GroupID"];
                if (!reader.IsDBNull(reader.GetOrdinal("IsPrimary"))) item.IsPrimary = (bool)reader["IsPrimary"];
                if (!reader.IsDBNull(reader.GetOrdinal("LinkMgtInventory"))) item.LinkMgtInventory = (bool)reader["LinkMgtInventory"];
                if (!reader.IsDBNull(reader.GetOrdinal("BillingServiceNote"))) item.BillingServiceNote = (string)reader["BillingServiceNote"];
                if (!reader.IsDBNull(reader.GetOrdinal("PackageMode"))) item.PackageMode = (bool)reader["PackageMode"];
                if (!reader.IsDBNull(reader.GetOrdinal("ReviewMode"))) item.ReviewMode = (bool)reader["ReviewMode"];
                if (!reader.IsDBNull(reader.GetOrdinal("SecondCategories"))) item.SecondCategories = (bool)reader["SecondCategories"];
                if (!reader.IsDBNull(reader.GetOrdinal("OperationType"))) item.OperationType = (byte)reader["OperationType"];
                if (!reader.IsDBNull(reader.GetOrdinal("Req_AVSMatched"))) item.Req_AVSMatched = (bool)reader["Req_AVSMatched"];
                if (!reader.IsDBNull(reader.GetOrdinal("Req_AVSZipMatched"))) item.Req_AVSZipMatched = (bool)reader["Req_AVSZipMatched"];
                if (!reader.IsDBNull(reader.GetOrdinal("IsShowUnsuccess"))) item.IsShowUnsuccess = (bool)reader["IsShowUnsuccess"];
                if (!reader.IsDBNull(reader.GetOrdinal("Req_NewCustomers"))) item.Req_NewCustomers = (bool)reader["Req_NewCustomers"];
                if (!reader.IsDBNull(reader.GetOrdinal("Req_NewOrders"))) item.Req_NewOrders = (bool)reader["Req_NewOrders"];
                if (!reader.IsDBNull(reader.GetOrdinal("EnReward"))) item.EnReward = (bool)reader["EnReward"];
                if (!reader.IsDBNull(reader.GetOrdinal("RewardMethod"))) item.RewardMethod = (bool)reader["RewardMethod"];
                if (!reader.IsDBNull(reader.GetOrdinal("CreditCalcValue"))) item.CreditCalcValue = (int)reader["CreditCalcValue"];
                if (!reader.IsDBNull(reader.GetOrdinal("CreditCalcType"))) item.CreditCalcType = (bool)reader["CreditCalcType"];
                if (!reader.IsDBNull(reader.GetOrdinal("PointCalcValue1"))) item.PointCalcValue1 = (int)reader["PointCalcValue1"];
                if (!reader.IsDBNull(reader.GetOrdinal("PointCalcValue2"))) item.PointCalcValue2 = (int)reader["PointCalcValue2"];
                if (!reader.IsDBNull(reader.GetOrdinal("RewardOrderMin"))) item.RewardOrderMin = (decimal)reader["RewardOrderMin"];
                if (!reader.IsDBNull(reader.GetOrdinal("EnLottery"))) item.EnLottery = (bool)reader["EnLottery"];
                if (!reader.IsDBNull(reader.GetOrdinal("ShowLotteryNum"))) item.ShowLotteryNum = (bool)reader["ShowLotteryNum"];
                if (!reader.IsDBNull(reader.GetOrdinal("TypeLottery"))) item.TypeLottery = (bool)reader["TypeLottery"];
                if (!reader.IsDBNull(reader.GetOrdinal("CycleSpin"))) item.CycleSpin = (int)reader["CycleSpin"];
                if (!reader.IsDBNull(reader.GetOrdinal("CycleType"))) item.CycleType = (byte)reader["CycleType"];
                if (!reader.IsDBNull(reader.GetOrdinal("StartDateLottery"))) item.StartDateLottery = (DateTime)reader["StartDateLottery"];
                if (!reader.IsDBNull(reader.GetOrdinal("EndDateLottery"))) item.EndDateLottery = (DateTime)reader["EndDateLottery"];
                if (!reader.IsDBNull(reader.GetOrdinal("PriceMode"))) item.PriceMode = (bool)reader["PriceMode"];
                if (!reader.IsDBNull(reader.GetOrdinal("EnPriceLevels"))) item.EnPriceLevels = (bool)reader["EnPriceLevels"];
                if (!reader.IsDBNull(reader.GetOrdinal("EnPricebyVolume"))) item.EnPricebyVolume = (bool)reader["EnPricebyVolume"];
                if (!reader.IsDBNull(reader.GetOrdinal("NumLevel"))) item.NumLevel = (byte)reader["NumLevel"];
                if (!reader.IsDBNull(reader.GetOrdinal("ExceedQtyContactType"))) item.ExceedQtyContactType = (bool)reader["ExceedQtyContactType"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgLWidth"))) item.ImgLWidth = (int)reader["ImgLWidth"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgMWidth"))) item.ImgMWidth = (int)reader["ImgMWidth"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgSWidth"))) item.ImgSWidth = (int)reader["ImgSWidth"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgTWidth"))) item.ImgTWidth = (int)reader["ImgTWidth"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgLHeight"))) item.ImgLHeight = (int)reader["ImgLHeight"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgMHeight"))) item.ImgMHeight = (int)reader["ImgMHeight"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgSHeight"))) item.ImgSHeight = (int)reader["ImgSHeight"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgTHeight"))) item.ImgTHeight = (int)reader["ImgTHeight"];
                if (!reader.IsDBNull(reader.GetOrdinal("MenuOption"))) item.MenuOption = (byte)reader["MenuOption"];
                if (!reader.IsDBNull(reader.GetOrdinal("ImgNameConvention"))) item.ImgNameConvention = (byte)reader["ImgNameConvention"];
                if (!reader.IsDBNull(reader.GetOrdinal("ChatStatus"))) item.ChatStatus = (byte)reader["ChatStatus"];
                if (!reader.IsDBNull(reader.GetOrdinal("CompanyName"))) item.CompanyName = (string)reader["CompanyName"];
                if (!reader.IsDBNull(reader.GetOrdinal("Address"))) item.Address = (string)reader["Address"];
                if (!reader.IsDBNull(reader.GetOrdinal("Phone"))) item.Phone = (string)reader["Phone"];
                if (!reader.IsDBNull(reader.GetOrdinal("Fax"))) item.Fax = (string)reader["Fax"];
                if (!reader.IsDBNull(reader.GetOrdinal("Email"))) item.Email = (string)reader["Email"];
                if (!reader.IsDBNull(reader.GetOrdinal("MinAucTransSuccessOfSeller"))) item.MinAucTransSuccessOfSeller = (int)reader["MinAucTransSuccessOfSeller"];
                if (!reader.IsDBNull(reader.GetOrdinal("EnMultiProductImg"))) item.EnMultiProductImg = (bool)reader["EnMultiProductImg"];
                if (!reader.IsDBNull(reader.GetOrdinal("EnMultiProductVideo"))) item.EnMultiProductVideo = (bool)reader["EnMultiProductVideo"];
                if (!reader.IsDBNull(reader.GetOrdinal("EnMultiProductPDF"))) item.EnMultiProductPDF = (bool)reader["EnMultiProductPDF"];
                if (!reader.IsDBNull(reader.GetOrdinal("EnProductReview"))) item.EnProductReview = (bool)reader["EnProductReview"];
                if (!reader.IsDBNull(reader.GetOrdinal("VideoNameConvention"))) item.VideoNameConvention = (byte)reader["VideoNameConvention"];
                if (!reader.IsDBNull(reader.GetOrdinal("DocNameConvention"))) item.DocNameConvention = (byte)reader["DocNameConvention"];
                if (!reader.IsDBNull(reader.GetOrdinal("ReqPhoneOfAdd"))) item.ReqPhoneOfAdd = (bool)reader["ReqPhoneOfAdd"];
                if (!reader.IsDBNull(reader.GetOrdinal("RqMatchCSC"))) item.RqMatchCSC = (bool)reader["RqMatchCSC"];
            }
            catch (Exception ex)
            {                
                throw ex;
            }
            return item;
        }
        #endregion
        
        #region Createa_DomPrefS methods
            
        public virtual void Createa_DomPrefS(a_DomPrefS a_DomPrefS)
        {
            try
            {
                Database database = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = database.GetStoredProcCommand("a_DomPrefS_ins");
                
                database.AddInParameter(dbCommand, "@DomainID", DbType.Int32, a_DomPrefS.DomainID);
                database.AddInParameter(dbCommand, "@PageSize", DbType.Int32, a_DomPrefS.PageSize);
                database.AddInParameter(dbCommand, "@PageSetSize", DbType.Int32, a_DomPrefS.PageSetSize);
                database.AddInParameter(dbCommand, "@InventoryMode", DbType.Boolean, a_DomPrefS.InventoryMode);
                database.AddInParameter(dbCommand, "@ProductMode", DbType.Boolean, a_DomPrefS.ProductMode);
                database.AddInParameter(dbCommand, "@FreeShipping", DbType.Boolean, a_DomPrefS.FreeShipping);
                database.AddInParameter(dbCommand, "@FreeShippingService", DbType.Int32, a_DomPrefS.FreeShippingService);
                database.AddInParameter(dbCommand, "@FreeShippingReqAmt", DbType.Currency, a_DomPrefS.FreeShippingReqAmt);
                database.AddInParameter(dbCommand, "@FreeShippingMsg", DbType.AnsiString, a_DomPrefS.FreeShippingMsg);
                database.AddInParameter(dbCommand, "@FreeTax", DbType.Boolean, a_DomPrefS.FreeTax);
                database.AddInParameter(dbCommand, "@FreeTaxReqAmt", DbType.Currency, a_DomPrefS.FreeTaxReqAmt);
                database.AddInParameter(dbCommand, "@FreeTaxMsg", DbType.AnsiString, a_DomPrefS.FreeTaxMsg);
                database.AddInParameter(dbCommand, "@OrigCity", DbType.AnsiString, a_DomPrefS.OrigCity);
                database.AddInParameter(dbCommand, "@OrigState", DbType.AnsiStringFixedLength, a_DomPrefS.OrigState);
                database.AddInParameter(dbCommand, "@OrigZipCode", DbType.AnsiString, a_DomPrefS.OrigZipCode);
                database.AddInParameter(dbCommand, "@OrigCountry", DbType.AnsiString, a_DomPrefS.OrigCountry);
                database.AddInParameter(dbCommand, "@ShipQuoteMethod1", DbType.Byte, a_DomPrefS.ShipQuoteMethod1);
                database.AddInParameter(dbCommand, "@ShipQuoteMethod2", DbType.Byte, a_DomPrefS.ShipQuoteMethod2);
                database.AddInParameter(dbCommand, "@ShippingCutOffTime", DbType.AnsiString, a_DomPrefS.ShippingCutOffTime);
                database.AddInParameter(dbCommand, "@ShippingSurCharge", DbType.Double, a_DomPrefS.ShippingSurCharge);
                database.AddInParameter(dbCommand, "@ShippingSurChargeUnit", DbType.Boolean, a_DomPrefS.ShippingSurChargeUnit);
                database.AddInParameter(dbCommand, "@AllowShip3rdParty", DbType.Boolean, a_DomPrefS.AllowShip3rdParty);
                database.AddInParameter(dbCommand, "@AllowShipAsGift", DbType.Boolean, a_DomPrefS.AllowShipAsGift);
                database.AddInParameter(dbCommand, "@WeightRangeCriteria", DbType.Boolean, a_DomPrefS.WeightRangeCriteria);
                database.AddInParameter(dbCommand, "@WeightRangeWOther", DbType.Boolean, a_DomPrefS.WeightRangeWOther);
                database.AddInParameter(dbCommand, "@UsuallyShipQtyLevel", DbType.Int32, a_DomPrefS.UsuallyShipQtyLevel);
                database.AddInParameter(dbCommand, "@ShowOutStockProd", DbType.Boolean, a_DomPrefS.ShowOutStockProd);
                database.AddInParameter(dbCommand, "@AllowOutStockOrder", DbType.Boolean, a_DomPrefS.AllowOutStockOrder);
                database.AddInParameter(dbCommand, "@OutStockMsg", DbType.AnsiString, a_DomPrefS.OutStockMsg);
                database.AddInParameter(dbCommand, "@UsuallyShipInvN", DbType.AnsiString, a_DomPrefS.UsuallyShipInvN);
                database.AddInParameter(dbCommand, "@UsuallyShipInvYontime", DbType.AnsiString, a_DomPrefS.UsuallyShipInvYontime);
                database.AddInParameter(dbCommand, "@UsuallyShipInvYlate", DbType.AnsiString, a_DomPrefS.UsuallyShipInvYlate);
                database.AddInParameter(dbCommand, "@TopNumberProd", DbType.AnsiString, a_DomPrefS.TopNumberProd);
                database.AddInParameter(dbCommand, "@SendLeadTo", DbType.AnsiString, a_DomPrefS.SendLeadTo);
                database.AddInParameter(dbCommand, "@SendDropShip", DbType.Boolean, a_DomPrefS.SendDropShip);
                database.AddInParameter(dbCommand, "@SendDropShipTo", DbType.AnsiString, a_DomPrefS.SendDropShipTo);
                database.AddInParameter(dbCommand, "@SendCSRTo", DbType.AnsiString, a_DomPrefS.SendCSRTo);
                database.AddInParameter(dbCommand, "@NewCustomerSurvey", DbType.Boolean, a_DomPrefS.NewCustomerSurvey);
                database.AddInParameter(dbCommand, "@SendmailID", DbType.Int32, a_DomPrefS.SendmailID);
                database.AddInParameter(dbCommand, "@PromoTimeStart", DbType.AnsiString, a_DomPrefS.PromoTimeStart);
                database.AddInParameter(dbCommand, "@PromoTimeEnd", DbType.AnsiString, a_DomPrefS.PromoTimeEnd);
                database.AddInParameter(dbCommand, "@PromoAutoExpireSD", DbType.Byte, a_DomPrefS.PromoAutoExpireSD);
                database.AddInParameter(dbCommand, "@PromoAutoExpireED", DbType.Byte, a_DomPrefS.PromoAutoExpireED);
                database.AddInParameter(dbCommand, "@Adm_PageSize", DbType.Int32, a_DomPrefS.Adm_PageSize);
                database.AddInParameter(dbCommand, "@Adm_PageSetSize", DbType.Int32, a_DomPrefS.Adm_PageSetSize);
                database.AddInParameter(dbCommand, "@DomainIP", DbType.AnsiString, a_DomPrefS.DomainIP);
                database.AddInParameter(dbCommand, "@DomainRootFolder", DbType.AnsiString, a_DomPrefS.DomainRootFolder);
                database.AddInParameter(dbCommand, "@Req_CSC", DbType.Boolean, a_DomPrefS.Req_CSC);
                database.AddInParameter(dbCommand, "@Req_MatchBillAddr", DbType.Boolean, a_DomPrefS.Req_MatchBillAddr);
                database.AddInParameter(dbCommand, "@Req_MatchCardholder", DbType.Boolean, a_DomPrefS.Req_MatchCardholder);
                database.AddInParameter(dbCommand, "@CODCharge", DbType.Currency, a_DomPrefS.CODCharge);
                database.AddInParameter(dbCommand, "@PayPalEmail", DbType.AnsiString, a_DomPrefS.PayPalEmail);
                database.AddInParameter(dbCommand, "@Currency", DbType.AnsiStringFixedLength, a_DomPrefS.Currency);
                database.AddInParameter(dbCommand, "@PromoEligible", DbType.Boolean, a_DomPrefS.PromoEligible);
                database.AddInParameter(dbCommand, "@StoreCount", DbType.Int32, a_DomPrefS.StoreCount);
                database.AddInParameter(dbCommand, "@Gateway_CC", DbType.AnsiString, a_DomPrefS.Gateway_CC);
                database.AddInParameter(dbCommand, "@Gateway_Check", DbType.AnsiString, a_DomPrefS.Gateway_Check);
                database.AddInParameter(dbCommand, "@Gateway_Login1", DbType.AnsiString, a_DomPrefS.Gateway_Login1);
                database.AddInParameter(dbCommand, "@Gateway_Login2", DbType.AnsiString, a_DomPrefS.Gateway_Login2);
                database.AddInParameter(dbCommand, "@Gateway_Password", DbType.AnsiString, a_DomPrefS.Gateway_Password);
                database.AddInParameter(dbCommand, "@Gateway_TransMode", DbType.Boolean, a_DomPrefS.Gateway_TransMode);
                database.AddInParameter(dbCommand, "@Gateway_TransType", DbType.AnsiString, a_DomPrefS.Gateway_TransType);
                database.AddInParameter(dbCommand, "@Gateway_Host", DbType.AnsiString, a_DomPrefS.Gateway_Host);
                database.AddInParameter(dbCommand, "@Gateway_Port", DbType.AnsiString, a_DomPrefS.Gateway_Port);
                database.AddInParameter(dbCommand, "@NumOfRetry", DbType.Int32, a_DomPrefS.NumOfRetry);
                database.AddInParameter(dbCommand, "@Req_UserAgreement", DbType.Boolean, a_DomPrefS.Req_UserAgreement);
                database.AddInParameter(dbCommand, "@LineDescOption", DbType.Byte, a_DomPrefS.LineDescOption);
                database.AddInParameter(dbCommand, "@MapBrand", DbType.AnsiString, a_DomPrefS.MapBrand);
                database.AddInParameter(dbCommand, "@MapColors", DbType.AnsiString, a_DomPrefS.MapColors);
                database.AddInParameter(dbCommand, "@MapSizes", DbType.AnsiString, a_DomPrefS.MapSizes);
                database.AddInParameter(dbCommand, "@MapCustom1", DbType.AnsiString, a_DomPrefS.MapCustom1);
                database.AddInParameter(dbCommand, "@MapCustom2", DbType.AnsiString, a_DomPrefS.MapCustom2);
                database.AddInParameter(dbCommand, "@MapCustom3", DbType.AnsiString, a_DomPrefS.MapCustom3);
                database.AddInParameter(dbCommand, "@MapCustom4", DbType.AnsiString, a_DomPrefS.MapCustom4);
                database.AddInParameter(dbCommand, "@GroupID", DbType.Int32, a_DomPrefS.GroupID);
                database.AddInParameter(dbCommand, "@IsPrimary", DbType.Boolean, a_DomPrefS.IsPrimary);
                database.AddInParameter(dbCommand, "@LinkMgtInventory", DbType.Boolean, a_DomPrefS.LinkMgtInventory);
                database.AddInParameter(dbCommand, "@BillingServiceNote", DbType.AnsiString, a_DomPrefS.BillingServiceNote);
                database.AddInParameter(dbCommand, "@PackageMode", DbType.Boolean, a_DomPrefS.PackageMode);
                database.AddInParameter(dbCommand, "@ReviewMode", DbType.Boolean, a_DomPrefS.ReviewMode);
                database.AddInParameter(dbCommand, "@SecondCategories", DbType.Boolean, a_DomPrefS.SecondCategories);
                database.AddInParameter(dbCommand, "@OperationType", DbType.Byte, a_DomPrefS.OperationType);
                database.AddInParameter(dbCommand, "@Req_AVSMatched", DbType.Boolean, a_DomPrefS.Req_AVSMatched);
                database.AddInParameter(dbCommand, "@Req_AVSZipMatched", DbType.Boolean, a_DomPrefS.Req_AVSZipMatched);
                database.AddInParameter(dbCommand, "@IsShowUnsuccess", DbType.Boolean, a_DomPrefS.IsShowUnsuccess);
                database.AddInParameter(dbCommand, "@Req_NewCustomers", DbType.Boolean, a_DomPrefS.Req_NewCustomers);
                database.AddInParameter(dbCommand, "@Req_NewOrders", DbType.Boolean, a_DomPrefS.Req_NewOrders);
                database.AddInParameter(dbCommand, "@EnReward", DbType.Boolean, a_DomPrefS.EnReward);
                database.AddInParameter(dbCommand, "@RewardMethod", DbType.Boolean, a_DomPrefS.RewardMethod);
                database.AddInParameter(dbCommand, "@CreditCalcValue", DbType.Int32, a_DomPrefS.CreditCalcValue);
                database.AddInParameter(dbCommand, "@CreditCalcType", DbType.Boolean, a_DomPrefS.CreditCalcType);
                database.AddInParameter(dbCommand, "@PointCalcValue1", DbType.Int32, a_DomPrefS.PointCalcValue1);
                database.AddInParameter(dbCommand, "@PointCalcValue2", DbType.Int32, a_DomPrefS.PointCalcValue2);
                database.AddInParameter(dbCommand, "@RewardOrderMin", DbType.Currency, a_DomPrefS.RewardOrderMin);
                database.AddInParameter(dbCommand, "@EnLottery", DbType.Boolean, a_DomPrefS.EnLottery);
                database.AddInParameter(dbCommand, "@ShowLotteryNum", DbType.Boolean, a_DomPrefS.ShowLotteryNum);
                database.AddInParameter(dbCommand, "@TypeLottery", DbType.Boolean, a_DomPrefS.TypeLottery);
                database.AddInParameter(dbCommand, "@CycleSpin", DbType.Int32, a_DomPrefS.CycleSpin);
                database.AddInParameter(dbCommand, "@CycleType", DbType.Byte, a_DomPrefS.CycleType);
                database.AddInParameter(dbCommand, "@StartDateLottery", DbType.DateTime, a_DomPrefS.StartDateLottery);
                database.AddInParameter(dbCommand, "@EndDateLottery", DbType.DateTime, a_DomPrefS.EndDateLottery);
                database.AddInParameter(dbCommand, "@PriceMode", DbType.Boolean, a_DomPrefS.PriceMode);
                database.AddInParameter(dbCommand, "@EnPriceLevels", DbType.Boolean, a_DomPrefS.EnPriceLevels);
                database.AddInParameter(dbCommand, "@EnPricebyVolume", DbType.Boolean, a_DomPrefS.EnPricebyVolume);
                database.AddInParameter(dbCommand, "@NumLevel", DbType.Byte, a_DomPrefS.NumLevel);
                database.AddInParameter(dbCommand, "@ExceedQtyContactType", DbType.Boolean, a_DomPrefS.ExceedQtyContactType);
                database.AddInParameter(dbCommand, "@ImgLWidth", DbType.Int32, a_DomPrefS.ImgLWidth);
                database.AddInParameter(dbCommand, "@ImgMWidth", DbType.Int32, a_DomPrefS.ImgMWidth);
                database.AddInParameter(dbCommand, "@ImgSWidth", DbType.Int32, a_DomPrefS.ImgSWidth);
                database.AddInParameter(dbCommand, "@ImgTWidth", DbType.Int32, a_DomPrefS.ImgTWidth);
                database.AddInParameter(dbCommand, "@ImgLHeight", DbType.Int32, a_DomPrefS.ImgLHeight);
                database.AddInParameter(dbCommand, "@ImgMHeight", DbType.Int32, a_DomPrefS.ImgMHeight);
                database.AddInParameter(dbCommand, "@ImgSHeight", DbType.Int32, a_DomPrefS.ImgSHeight);
                database.AddInParameter(dbCommand, "@ImgTHeight", DbType.Int32, a_DomPrefS.ImgTHeight);
                database.AddInParameter(dbCommand, "@MenuOption", DbType.Byte, a_DomPrefS.MenuOption);
                database.AddInParameter(dbCommand, "@ImgNameConvention", DbType.Byte, a_DomPrefS.ImgNameConvention);
                database.AddInParameter(dbCommand, "@ChatStatus", DbType.Byte, a_DomPrefS.ChatStatus);
                database.AddInParameter(dbCommand, "@CompanyName", DbType.String, a_DomPrefS.CompanyName);
                database.AddInParameter(dbCommand, "@Address", DbType.String, a_DomPrefS.Address);
                database.AddInParameter(dbCommand, "@Phone", DbType.AnsiString, a_DomPrefS.Phone);
                database.AddInParameter(dbCommand, "@Fax", DbType.AnsiString, a_DomPrefS.Fax);
                database.AddInParameter(dbCommand, "@Email", DbType.AnsiString, a_DomPrefS.Email);
                database.AddInParameter(dbCommand, "@MinAucTransSuccessOfSeller", DbType.Int32, a_DomPrefS.MinAucTransSuccessOfSeller);
                database.AddInParameter(dbCommand, "@EnMultiProductImg", DbType.Boolean, a_DomPrefS.EnMultiProductImg);
                database.AddInParameter(dbCommand, "@EnMultiProductVideo", DbType.Boolean, a_DomPrefS.EnMultiProductVideo);
                database.AddInParameter(dbCommand, "@EnMultiProductPDF", DbType.Boolean, a_DomPrefS.EnMultiProductPDF);
                database.AddInParameter(dbCommand, "@EnProductReview", DbType.Boolean, a_DomPrefS.EnProductReview);
                database.AddInParameter(dbCommand, "@VideoNameConvention", DbType.Byte, a_DomPrefS.VideoNameConvention);
                database.AddInParameter(dbCommand, "@DocNameConvention", DbType.Byte, a_DomPrefS.DocNameConvention);
                database.AddInParameter(dbCommand, "@ReqPhoneOfAdd", DbType.Boolean, a_DomPrefS.ReqPhoneOfAdd);
                database.AddInParameter(dbCommand, "@RqMatchCSC", DbType.Boolean, a_DomPrefS.RqMatchCSC);
                database.AddOutParameter(dbCommand, "@PrefID", DbType.Int32, 0);
                
                database.ExecuteNonQuery(dbCommand);
                a_DomPrefS.PrefID = (int)database.GetParameterValue(dbCommand, "@PrefID");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region Updatea_DomPrefS methods
        
        public virtual void Updatea_DomPrefS(a_DomPrefS a_DomPrefS)
        {
            try
            {
                Database database = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = database.GetStoredProcCommand("a_DomPrefS_upd");            
                
                database.AddInParameter(dbCommand, "@PrefID", DbType.Int32, a_DomPrefS.PrefID);
                database.AddInParameter(dbCommand, "@DomainID", DbType.Int32, a_DomPrefS.DomainID);
                database.AddInParameter(dbCommand, "@PageSize", DbType.Int32, a_DomPrefS.PageSize);
                database.AddInParameter(dbCommand, "@PageSetSize", DbType.Int32, a_DomPrefS.PageSetSize);
                database.AddInParameter(dbCommand, "@InventoryMode", DbType.Boolean, a_DomPrefS.InventoryMode);
                database.AddInParameter(dbCommand, "@ProductMode", DbType.Boolean, a_DomPrefS.ProductMode);
                database.AddInParameter(dbCommand, "@FreeShipping", DbType.Boolean, a_DomPrefS.FreeShipping);
                database.AddInParameter(dbCommand, "@FreeShippingService", DbType.Int32, a_DomPrefS.FreeShippingService);
                database.AddInParameter(dbCommand, "@FreeShippingReqAmt", DbType.Currency, a_DomPrefS.FreeShippingReqAmt);
                database.AddInParameter(dbCommand, "@FreeShippingMsg", DbType.AnsiString, a_DomPrefS.FreeShippingMsg);
                database.AddInParameter(dbCommand, "@FreeTax", DbType.Boolean, a_DomPrefS.FreeTax);
                database.AddInParameter(dbCommand, "@FreeTaxReqAmt", DbType.Currency, a_DomPrefS.FreeTaxReqAmt);
                database.AddInParameter(dbCommand, "@FreeTaxMsg", DbType.AnsiString, a_DomPrefS.FreeTaxMsg);
                database.AddInParameter(dbCommand, "@OrigCity", DbType.AnsiString, a_DomPrefS.OrigCity);
                database.AddInParameter(dbCommand, "@OrigState", DbType.AnsiStringFixedLength, a_DomPrefS.OrigState);
                database.AddInParameter(dbCommand, "@OrigZipCode", DbType.AnsiString, a_DomPrefS.OrigZipCode);
                database.AddInParameter(dbCommand, "@OrigCountry", DbType.AnsiString, a_DomPrefS.OrigCountry);
                database.AddInParameter(dbCommand, "@ShipQuoteMethod1", DbType.Byte, a_DomPrefS.ShipQuoteMethod1);
                database.AddInParameter(dbCommand, "@ShipQuoteMethod2", DbType.Byte, a_DomPrefS.ShipQuoteMethod2);
                database.AddInParameter(dbCommand, "@ShippingCutOffTime", DbType.AnsiString, a_DomPrefS.ShippingCutOffTime);
                database.AddInParameter(dbCommand, "@ShippingSurCharge", DbType.Double, a_DomPrefS.ShippingSurCharge);
                database.AddInParameter(dbCommand, "@ShippingSurChargeUnit", DbType.Boolean, a_DomPrefS.ShippingSurChargeUnit);
                database.AddInParameter(dbCommand, "@AllowShip3rdParty", DbType.Boolean, a_DomPrefS.AllowShip3rdParty);
                database.AddInParameter(dbCommand, "@AllowShipAsGift", DbType.Boolean, a_DomPrefS.AllowShipAsGift);
                database.AddInParameter(dbCommand, "@WeightRangeCriteria", DbType.Boolean, a_DomPrefS.WeightRangeCriteria);
                database.AddInParameter(dbCommand, "@WeightRangeWOther", DbType.Boolean, a_DomPrefS.WeightRangeWOther);
                database.AddInParameter(dbCommand, "@UsuallyShipQtyLevel", DbType.Int32, a_DomPrefS.UsuallyShipQtyLevel);
                database.AddInParameter(dbCommand, "@ShowOutStockProd", DbType.Boolean, a_DomPrefS.ShowOutStockProd);
                database.AddInParameter(dbCommand, "@AllowOutStockOrder", DbType.Boolean, a_DomPrefS.AllowOutStockOrder);
                database.AddInParameter(dbCommand, "@OutStockMsg", DbType.AnsiString, a_DomPrefS.OutStockMsg);
                database.AddInParameter(dbCommand, "@UsuallyShipInvN", DbType.AnsiString, a_DomPrefS.UsuallyShipInvN);
                database.AddInParameter(dbCommand, "@UsuallyShipInvYontime", DbType.AnsiString, a_DomPrefS.UsuallyShipInvYontime);
                database.AddInParameter(dbCommand, "@UsuallyShipInvYlate", DbType.AnsiString, a_DomPrefS.UsuallyShipInvYlate);
                database.AddInParameter(dbCommand, "@TopNumberProd", DbType.AnsiString, a_DomPrefS.TopNumberProd);
                database.AddInParameter(dbCommand, "@SendLeadTo", DbType.AnsiString, a_DomPrefS.SendLeadTo);
                database.AddInParameter(dbCommand, "@SendDropShip", DbType.Boolean, a_DomPrefS.SendDropShip);
                database.AddInParameter(dbCommand, "@SendDropShipTo", DbType.AnsiString, a_DomPrefS.SendDropShipTo);
                database.AddInParameter(dbCommand, "@SendCSRTo", DbType.AnsiString, a_DomPrefS.SendCSRTo);
                database.AddInParameter(dbCommand, "@NewCustomerSurvey", DbType.Boolean, a_DomPrefS.NewCustomerSurvey);
                database.AddInParameter(dbCommand, "@SendmailID", DbType.Int32, a_DomPrefS.SendmailID);
                database.AddInParameter(dbCommand, "@PromoTimeStart", DbType.AnsiString, a_DomPrefS.PromoTimeStart);
                database.AddInParameter(dbCommand, "@PromoTimeEnd", DbType.AnsiString, a_DomPrefS.PromoTimeEnd);
                database.AddInParameter(dbCommand, "@PromoAutoExpireSD", DbType.Byte, a_DomPrefS.PromoAutoExpireSD);
                database.AddInParameter(dbCommand, "@PromoAutoExpireED", DbType.Byte, a_DomPrefS.PromoAutoExpireED);
                database.AddInParameter(dbCommand, "@Adm_PageSize", DbType.Int32, a_DomPrefS.Adm_PageSize);
                database.AddInParameter(dbCommand, "@Adm_PageSetSize", DbType.Int32, a_DomPrefS.Adm_PageSetSize);
                database.AddInParameter(dbCommand, "@DomainIP", DbType.AnsiString, a_DomPrefS.DomainIP);
                database.AddInParameter(dbCommand, "@DomainRootFolder", DbType.AnsiString, a_DomPrefS.DomainRootFolder);
                database.AddInParameter(dbCommand, "@Req_CSC", DbType.Boolean, a_DomPrefS.Req_CSC);
                database.AddInParameter(dbCommand, "@Req_MatchBillAddr", DbType.Boolean, a_DomPrefS.Req_MatchBillAddr);
                database.AddInParameter(dbCommand, "@Req_MatchCardholder", DbType.Boolean, a_DomPrefS.Req_MatchCardholder);
                database.AddInParameter(dbCommand, "@CODCharge", DbType.Currency, a_DomPrefS.CODCharge);
                database.AddInParameter(dbCommand, "@PayPalEmail", DbType.AnsiString, a_DomPrefS.PayPalEmail);
                database.AddInParameter(dbCommand, "@Currency", DbType.AnsiStringFixedLength, a_DomPrefS.Currency);
                database.AddInParameter(dbCommand, "@PromoEligible", DbType.Boolean, a_DomPrefS.PromoEligible);
                database.AddInParameter(dbCommand, "@StoreCount", DbType.Int32, a_DomPrefS.StoreCount);
                database.AddInParameter(dbCommand, "@Gateway_CC", DbType.AnsiString, a_DomPrefS.Gateway_CC);
                database.AddInParameter(dbCommand, "@Gateway_Check", DbType.AnsiString, a_DomPrefS.Gateway_Check);
                database.AddInParameter(dbCommand, "@Gateway_Login1", DbType.AnsiString, a_DomPrefS.Gateway_Login1);
                database.AddInParameter(dbCommand, "@Gateway_Login2", DbType.AnsiString, a_DomPrefS.Gateway_Login2);
                database.AddInParameter(dbCommand, "@Gateway_Password", DbType.AnsiString, a_DomPrefS.Gateway_Password);
                database.AddInParameter(dbCommand, "@Gateway_TransMode", DbType.Boolean, a_DomPrefS.Gateway_TransMode);
                database.AddInParameter(dbCommand, "@Gateway_TransType", DbType.AnsiString, a_DomPrefS.Gateway_TransType);
                database.AddInParameter(dbCommand, "@Gateway_Host", DbType.AnsiString, a_DomPrefS.Gateway_Host);
                database.AddInParameter(dbCommand, "@Gateway_Port", DbType.AnsiString, a_DomPrefS.Gateway_Port);
                database.AddInParameter(dbCommand, "@NumOfRetry", DbType.Int32, a_DomPrefS.NumOfRetry);
                database.AddInParameter(dbCommand, "@Req_UserAgreement", DbType.Boolean, a_DomPrefS.Req_UserAgreement);
                database.AddInParameter(dbCommand, "@LineDescOption", DbType.Byte, a_DomPrefS.LineDescOption);
                database.AddInParameter(dbCommand, "@MapBrand", DbType.AnsiString, a_DomPrefS.MapBrand);
                database.AddInParameter(dbCommand, "@MapColors", DbType.AnsiString, a_DomPrefS.MapColors);
                database.AddInParameter(dbCommand, "@MapSizes", DbType.AnsiString, a_DomPrefS.MapSizes);
                database.AddInParameter(dbCommand, "@MapCustom1", DbType.AnsiString, a_DomPrefS.MapCustom1);
                database.AddInParameter(dbCommand, "@MapCustom2", DbType.AnsiString, a_DomPrefS.MapCustom2);
                database.AddInParameter(dbCommand, "@MapCustom3", DbType.AnsiString, a_DomPrefS.MapCustom3);
                database.AddInParameter(dbCommand, "@MapCustom4", DbType.AnsiString, a_DomPrefS.MapCustom4);
                database.AddInParameter(dbCommand, "@GroupID", DbType.Int32, a_DomPrefS.GroupID);
                database.AddInParameter(dbCommand, "@IsPrimary", DbType.Boolean, a_DomPrefS.IsPrimary);
                database.AddInParameter(dbCommand, "@LinkMgtInventory", DbType.Boolean, a_DomPrefS.LinkMgtInventory);
                database.AddInParameter(dbCommand, "@BillingServiceNote", DbType.AnsiString, a_DomPrefS.BillingServiceNote);
                database.AddInParameter(dbCommand, "@PackageMode", DbType.Boolean, a_DomPrefS.PackageMode);
                database.AddInParameter(dbCommand, "@ReviewMode", DbType.Boolean, a_DomPrefS.ReviewMode);
                database.AddInParameter(dbCommand, "@SecondCategories", DbType.Boolean, a_DomPrefS.SecondCategories);
                database.AddInParameter(dbCommand, "@OperationType", DbType.Byte, a_DomPrefS.OperationType);
                database.AddInParameter(dbCommand, "@Req_AVSMatched", DbType.Boolean, a_DomPrefS.Req_AVSMatched);
                database.AddInParameter(dbCommand, "@Req_AVSZipMatched", DbType.Boolean, a_DomPrefS.Req_AVSZipMatched);
                database.AddInParameter(dbCommand, "@IsShowUnsuccess", DbType.Boolean, a_DomPrefS.IsShowUnsuccess);
                database.AddInParameter(dbCommand, "@Req_NewCustomers", DbType.Boolean, a_DomPrefS.Req_NewCustomers);
                database.AddInParameter(dbCommand, "@Req_NewOrders", DbType.Boolean, a_DomPrefS.Req_NewOrders);
                database.AddInParameter(dbCommand, "@EnReward", DbType.Boolean, a_DomPrefS.EnReward);
                database.AddInParameter(dbCommand, "@RewardMethod", DbType.Boolean, a_DomPrefS.RewardMethod);
                database.AddInParameter(dbCommand, "@CreditCalcValue", DbType.Int32, a_DomPrefS.CreditCalcValue);
                database.AddInParameter(dbCommand, "@CreditCalcType", DbType.Boolean, a_DomPrefS.CreditCalcType);
                database.AddInParameter(dbCommand, "@PointCalcValue1", DbType.Int32, a_DomPrefS.PointCalcValue1);
                database.AddInParameter(dbCommand, "@PointCalcValue2", DbType.Int32, a_DomPrefS.PointCalcValue2);
                database.AddInParameter(dbCommand, "@RewardOrderMin", DbType.Currency, a_DomPrefS.RewardOrderMin);
                database.AddInParameter(dbCommand, "@EnLottery", DbType.Boolean, a_DomPrefS.EnLottery);
                database.AddInParameter(dbCommand, "@ShowLotteryNum", DbType.Boolean, a_DomPrefS.ShowLotteryNum);
                database.AddInParameter(dbCommand, "@TypeLottery", DbType.Boolean, a_DomPrefS.TypeLottery);
                database.AddInParameter(dbCommand, "@CycleSpin", DbType.Int32, a_DomPrefS.CycleSpin);
                database.AddInParameter(dbCommand, "@CycleType", DbType.Byte, a_DomPrefS.CycleType);
                database.AddInParameter(dbCommand, "@StartDateLottery", DbType.DateTime, a_DomPrefS.StartDateLottery);
                database.AddInParameter(dbCommand, "@EndDateLottery", DbType.DateTime, a_DomPrefS.EndDateLottery);
                database.AddInParameter(dbCommand, "@PriceMode", DbType.Boolean, a_DomPrefS.PriceMode);
                database.AddInParameter(dbCommand, "@EnPriceLevels", DbType.Boolean, a_DomPrefS.EnPriceLevels);
                database.AddInParameter(dbCommand, "@EnPricebyVolume", DbType.Boolean, a_DomPrefS.EnPricebyVolume);
                database.AddInParameter(dbCommand, "@NumLevel", DbType.Byte, a_DomPrefS.NumLevel);
                database.AddInParameter(dbCommand, "@ExceedQtyContactType", DbType.Boolean, a_DomPrefS.ExceedQtyContactType);
                database.AddInParameter(dbCommand, "@ImgLWidth", DbType.Int32, a_DomPrefS.ImgLWidth);
                database.AddInParameter(dbCommand, "@ImgMWidth", DbType.Int32, a_DomPrefS.ImgMWidth);
                database.AddInParameter(dbCommand, "@ImgSWidth", DbType.Int32, a_DomPrefS.ImgSWidth);
                database.AddInParameter(dbCommand, "@ImgTWidth", DbType.Int32, a_DomPrefS.ImgTWidth);
                database.AddInParameter(dbCommand, "@ImgLHeight", DbType.Int32, a_DomPrefS.ImgLHeight);
                database.AddInParameter(dbCommand, "@ImgMHeight", DbType.Int32, a_DomPrefS.ImgMHeight);
                database.AddInParameter(dbCommand, "@ImgSHeight", DbType.Int32, a_DomPrefS.ImgSHeight);
                database.AddInParameter(dbCommand, "@ImgTHeight", DbType.Int32, a_DomPrefS.ImgTHeight);
                database.AddInParameter(dbCommand, "@MenuOption", DbType.Byte, a_DomPrefS.MenuOption);
                database.AddInParameter(dbCommand, "@ImgNameConvention", DbType.Byte, a_DomPrefS.ImgNameConvention);
                database.AddInParameter(dbCommand, "@ChatStatus", DbType.Byte, a_DomPrefS.ChatStatus);
                database.AddInParameter(dbCommand, "@CompanyName", DbType.String, a_DomPrefS.CompanyName);
                database.AddInParameter(dbCommand, "@Address", DbType.String, a_DomPrefS.Address);
                database.AddInParameter(dbCommand, "@Phone", DbType.AnsiString, a_DomPrefS.Phone);
                database.AddInParameter(dbCommand, "@Fax", DbType.AnsiString, a_DomPrefS.Fax);
                database.AddInParameter(dbCommand, "@Email", DbType.AnsiString, a_DomPrefS.Email);
                database.AddInParameter(dbCommand, "@MinAucTransSuccessOfSeller", DbType.Int32, a_DomPrefS.MinAucTransSuccessOfSeller);
                database.AddInParameter(dbCommand, "@EnMultiProductImg", DbType.Boolean, a_DomPrefS.EnMultiProductImg);
                database.AddInParameter(dbCommand, "@EnMultiProductVideo", DbType.Boolean, a_DomPrefS.EnMultiProductVideo);
                database.AddInParameter(dbCommand, "@EnMultiProductPDF", DbType.Boolean, a_DomPrefS.EnMultiProductPDF);
                database.AddInParameter(dbCommand, "@EnProductReview", DbType.Boolean, a_DomPrefS.EnProductReview);
                database.AddInParameter(dbCommand, "@VideoNameConvention", DbType.Byte, a_DomPrefS.VideoNameConvention);
                database.AddInParameter(dbCommand, "@DocNameConvention", DbType.Byte, a_DomPrefS.DocNameConvention);
                database.AddInParameter(dbCommand, "@ReqPhoneOfAdd", DbType.Boolean, a_DomPrefS.ReqPhoneOfAdd);
                database.AddInParameter(dbCommand, "@RqMatchCSC", DbType.Boolean, a_DomPrefS.RqMatchCSC);
                
                database.ExecuteNonQuery(dbCommand);
            }
            catch (Exception ex)
            {
               throw ex;
            }
        }
        
        #endregion

        #region Deletea_DomPrefS methods
        public virtual void Deletea_DomPrefS(int prefID)
        {
            try
            {
                Database database = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = database.GetStoredProcCommand("a_DomPrefS_del");
                
                database.AddInParameter(dbCommand, "@PrefID", DbType.Int32, prefID);
                
                database.ExecuteNonQuery(dbCommand);
            }
            catch (Exception ex)
            {
               throw ex;
            }
        }

        #endregion

        #region Geta_DomPrefS methods
        
        public virtual a_DomPrefS Geta_DomPrefS(int prefID)
        {            
            try
            {
                Database database = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = database.GetStoredProcCommand("a_DomPrefS_sel");
                
                database.AddInParameter(dbCommand, "@PrefID", DbType.Int32, prefID);
                
                a_DomPrefS a_DomPrefS =  null;
                using (IDataReader reader = database.ExecuteReader(dbCommand))
                {
                    if (reader.Read())
                    {
                        a_DomPrefS = Createa_DomPrefSFromReader(reader);
                        reader.Close();
                    }
                }
                return a_DomPrefS;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        
        #endregion

        #region Geta_DomPrefSList methods
        public virtual a_DomPrefSCollection Geta_DomPrefSList(a_DomPrefSColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                Database database = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = database.GetStoredProcCommand("a_DomPrefS_selList");
                
                database.AddInParameter(dbCommand, "@OrderBy", DbType.AnsiString, orderBy.ToString());
                database.AddInParameter(dbCommand, "@OrderDirection", DbType.AnsiString, orderDirection.ToString());
                database.AddInParameter(dbCommand, "@Page", DbType.Int32, page);
                database.AddInParameter(dbCommand, "@PageSize", DbType.Int32, pageSize);
                database.AddOutParameter(dbCommand, "@TotalRecords", DbType.Int32, 4);
                
                a_DomPrefSCollection a_DomPrefSCollection = new a_DomPrefSCollection();
                using (IDataReader reader = database.ExecuteReader(dbCommand))
                {
                    while (reader.Read())
                    {
                        a_DomPrefS a_DomPrefS = Createa_DomPrefSFromReader(reader);
                        a_DomPrefSCollection.Add(a_DomPrefS);
                    }
                    reader.Close();
                }
                totalRecords = (int)database.GetParameterValue(dbCommand, "@TotalRecords");
                return a_DomPrefSCollection;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        
        public virtual a_DomPrefSCollection Geta_DomPrefSList(a_DomPrefSColumns orderBy, OrderDirection orderDirection)
        {            
            int totalRecords = 0;
            return Geta_DomPrefSList(orderBy, orderDirection, 0, 0, out totalRecords);
        }
        
        #endregion
    }
}